<%@ Control Language="VB" AutoEventWireup="false" CodeFile="AddAward.ascx.vb" Inherits="WebForm_ManageAward_AddAward" %>
<%@ Register src="SearchVolunteerControl.ascx" tagname="SearchVolunteerControl" tagprefix="uc1" %>
<%@ Register Src="~/WebForm/CommonControl/AnnualControl.ascx" TagName="AnnualControl"
    TagPrefix="My" %>    

<asp:FormView ID="FV" runat="server" DataSourceID="ObjectDataSource_FV" 
    DataKeyNames="AwardID" >
    <ItemTemplate>
        <table>
            
            <tr>
                <td align="right">
                    <asp:Label ID="lblAwardName" runat="server" meta:resourcekey="lblAwardName"></asp:Label>
                </td>
                <td align="left">
                    <asp:TextBox ID="txtAwardName" runat="server" Text='<%# Bind("AwardName") %>' 
                        MaxLength="50"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvAwardName" runat="server" Display="None" ControlToValidate="txtAwardName" meta:resourcekey="rfvAwardName" ValidationGroup="vInsert"></asp:RequiredFieldValidator>
                </td>
            </tr>
            
            
            <tr>
                <td align="right">
                    <asp:Label ID="lblAnnual" runat="server" meta:resourcekey="lblAnnual"></asp:Label>
                </td>
                <td align="left">
                    <My:AnnualControl ID="txtAnnual" runat="server" Anaual='<%# Bind("Annual") %>' />
<%--                    <asp:TextBox ID="txtAnnual" runat="server" Text='<%# Bind("Annual") %>' 
                        MaxLength="5"></asp:TextBox>                    
                    <asp:Label ID="lblAnnualhint" runat="server" meta:resourcekey="lblAnnualhint"></asp:Label>
                    <asp:RegularExpressionValidator ID="rfvAnnual" runat="server" Display="None" ControlToValidate="txtAnnual" meta:resourcekey="rfvAnnual" ValidationGroup="vInsert" ValidationExpression="[0-9]{4}"></asp:RegularExpressionValidator>
--%>                </td>
            </tr>
            
            <tr>
                <td align="right">
                    <asp:Label ID="lblDescription" runat="server" meta:resourcekey="lblDescription"></asp:Label>
                </td>
                <td align="left">
                    <asp:TextBox ID="txtDescription" runat="server" 
                        Text='<%# Bind("Description") %>' TextMode="MultiLine" Rows="5" Columns="50" 
                        MaxLength="50"></asp:TextBox>
                </td>
            </tr>
            
            
        </table>
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
            ShowSummary="false" ValidationGroup="vInsert" />
    </ItemTemplate>
</asp:FormView>
<asp:ObjectDataSource ID="ObjectDataSource_FV" runat="server" 
    InsertMethod="BLL_Insert" OldValuesParameterFormatString="original_{0}" 
    SelectMethod="BLL_Select" TypeName="BLL_Award" UpdateMethod="BLL_Update">
    <UpdateParameters>
        <asp:Parameter Name="AwardName" Type="String" />
        <asp:Parameter Name="Annual" Type="Int32" />
        <asp:Parameter Name="Description" Type="String" />
        <asp:Parameter Name="CreateBy" Type="String" />
        <asp:Parameter Name="original_AwardID" Type="Int32" />
    </UpdateParameters>
    <SelectParameters>
        <asp:Parameter Name="AwardID" Type="Int32" />
    </SelectParameters>
    <InsertParameters>
        <asp:Parameter Name="AwardName" Type="String" />
        <asp:Parameter Name="Annual" Type="Int32" />
        <asp:Parameter Name="Description" Type="String" />
        <asp:Parameter Name="CreateBy" Type="String" />
    </InsertParameters>
</asp:ObjectDataSource>
<table width="100%">
    <tr>
        <td align="right">
            <div align="center">

                    <asp:Button ID="btnSave" runat="server" meta:resourcekey="btnSave" 
                        CommandName="btnSave" ValidationGroup="vInsert" />

                    </div>
            <asp:Button ID="btnShow" runat="server" Text="<%$ Resources:ShowPerson %>" 
                ValidationGroup="vInsert" />

                    <ajaxToolkit:ConfirmButtonExtender ID="cbSave" runat="server" 
                        TargetControlID="btnSave" meta:resourcekey="cbSave"></ajaxToolkit:ConfirmButtonExtender>
        </td>
    </tr>
</table>
<My:MyGridView ID="GridView_Volunteers" runat="server" AllowHoverEffect="False" 
    AllowHoverSelect="False" AllowSorting="True" AutoGenerateColumns="False" 
    DataKeyNames="AwardID,VolunteerID" 
    DataSourceID="ObjectDataSource_Volunteers"  
    MySortDirection="Ascending" SkinID="pager">
    <Columns>
        <asp:BoundField DataField="VolunteerID" 
            HeaderText="<%$ Resources:VolunteerID %>" ReadOnly="True" />
        <asp:BoundField DataField="VolunteerName" 
            HeaderText="<%$ Resources:VolunteerName %>" ReadOnly="True" />
        <asp:TemplateField HeaderText="<%$ Resources:AwardReason %>" SortExpression="AwardReason">
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# Bind("AwardReason") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtAwardReason" runat="server" 
                    Text='<%# Bind("AwardReason") %>' Height="57px" MaxLength="200" 
                    TextMode="MultiLine" Width="300px"></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField ShowHeader="False">
            <ItemTemplate>
                <asp:LinkButton ID="lbtnEdit" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="<%$ Resources:Edit %>"></asp:LinkButton>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:LinkButton ID="lbtnUpdate" runat="server" CommandName="Update" 
                    Text="<%$ Resources:Update %>"></asp:LinkButton>
                &nbsp;<asp:LinkButton ID="lbtnCancel" runat="server" CausesValidation="False" 
                    CommandName="Cancel" Text="<%$ Resources:Cancel %>"></asp:LinkButton>
            </EditItemTemplate>
            <ItemStyle HorizontalAlign="Center" />
        </asp:TemplateField>
        <asp:TemplateField ShowHeader="False">
            <ItemTemplate>
                <asp:LinkButton ID="lbtnDelete" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="<%$ Resources:Delete %>"></asp:LinkButton>
                <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" 
                    ConfirmText="<%$ Resources:ConfirmDelete %>" Enabled="True" 
                    TargetControlID="lbtnDelete">
                </ajaxToolkit:ConfirmButtonExtender>
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Center" />
        </asp:TemplateField>
    </Columns>
</My:MyGridView>
<asp:ObjectDataSource ID="ObjectDataSource_Volunteers" runat="server" 
    DeleteMethod="BLL_Delete" OldValuesParameterFormatString="original_{0}" 
    SelectMethod="BLL_Select" TypeName="BLL_AddAward" 
    UpdateMethod="BLL_Update">
    <DeleteParameters>
        <asp:Parameter Name="original_AwardID" Type="Int32" />
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter Name="AwardReason" Type="string" />
        <asp:Parameter Name="VolunteerID" Type="string" />
        <asp:Parameter Name="original_AwardID" Type="Int32" />
    </UpdateParameters>
    <SelectParameters>
        <asp:Parameter Name="AwardID" Type="Int32" />
    </SelectParameters>
</asp:ObjectDataSource>
<uc1:SearchVolunteerControl ID="SearchVolunteerControl1" runat="server" />
